home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / Random.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.1 KB  |  70 lines

  1. /* Interface for Objective-C object providing randoms in uniform distribution
  2.    Copyright (C) 1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: May 1993
  6.  
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */ 
  23.  
  24. #ifndef __Random_h_INCLUDE_GNU
  25. #define __Random_h_INCLUDE_GNU
  26.  
  27. #include <objects/stdobjects.h>
  28. #include <objects/RandomGenerating.h>
  29.  
  30. @interface Random : Object
  31. {
  32.   id <RandomGenerating> rng;
  33. }
  34.  
  35. + initialize;
  36. + (id <RandomGenerating>) defaultRandomGeneratorClass;
  37. + setDefaultRandomGeneratorClass: (id <RandomGenerating>)aRNG;
  38.  
  39. + (float) chiSquareOfRandomGenerator: (id <RandomGenerating>)aRNG
  40.    iterations: (int)n
  41.    range: (long)r;
  42. + (float) chiSquareOfRandomGenerator: (id <RandomGenerating>)aRNG;
  43.  
  44. - init;
  45.  
  46. - setRandomSeedFromClock;
  47. - setRandomSeed: (long)seed;
  48.  
  49. - (long) randomInt;
  50. - (long) randomIntBetween: (long)lowBound and: (long)highBound;
  51. - (long) randomDie: (long)numSides; /* between 0 and numSides-1 */
  52.  
  53. - (BOOL) randomCoin;
  54. - (BOOL) randomCoinWithProbability: (double)p;
  55.  
  56. - (float) randomFloat;
  57. - (float) randomFloatBetween: (float)lowBound and: (float)highBound;
  58. - (float) randomFloatProbability;
  59.  
  60. - (double) randomDouble;
  61. - (double) randomDoubleBetween: (double)lowBound and: (double)highBound;
  62. - (double) randomDoubleProbability;
  63.  
  64. - read: (TypedStream*)aStream;
  65. - write: (TypedStream*)aStream;
  66.  
  67. @end
  68.  
  69. #endif /* __Random_h_INCLUDE_GNU */
  70.